'''
迭代
    通过for循环遍历列表或元组的过程，称为迭代
'''

# 迭代一个列表
for i in [1,2,3,4,5]:
    print(i)

# 字典-迭代的是key
d = {'a':1,'b':2,'c':3}
for key in d:
    print(key,d[key])

# 字典-迭代value
for value in d.values():
    print(value)

# 字典-同时迭代key和value
for key,value in d.items():
    print(key,value)

'''
Iterable ：类 可迭代对象
'''
from collections.abc import Iterable

# 判断是否是可迭代对象
print(isinstance('abc',Iterable))
print(isinstance([1,2,3],Iterable))
print(isinstance(123,Iterable))
print(isinstance(range(5),Iterable))